//
//  ZSBNewOrdorDetailCell.m
//  HCNewGoldFinger
//
//  Created by 刘琛 on 2018/3/7.
//  Copyright © 2018年 zjhcsoftios. All rights reserved.
//

#import "ZSBNewOrdorDetailCell.h"
#import "UIColor+Ex.h"

@interface ZSBNewOrdorDetailCell()

@property (weak, nonatomic) IBOutlet UIImageView *step;
@property (weak, nonatomic) IBOutlet UILabel *ordorStatusLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UILabel *stepDetailLabel;
@property (weak, nonatomic) IBOutlet UIView *stepTopView;
@property (weak, nonatomic) IBOutlet UIView *stepButtomView;
@property (weak, nonatomic) IBOutlet UIView *buttomLine;

@end

@implementation ZSBNewOrdorDetailCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    _stepTopView.hidden = NO;
    _stepButtomView.hidden = NO;
    _step.image = [UIImage imageNamed:@"dot_grey"];
    _buttomLine.hidden = NO;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

- (void)setIsFirstCell:(BOOL)isFirstCell {
    _isFirstCell = isFirstCell;
    if (_isFirstCell) {
        _stepTopView.hidden = _isFirstCell;
        _step.image = [UIImage imageNamed:@"Group 2"];
    }
}

- (void)setIsLastCell:(BOOL)isLastCell {
    _isLastCell = isLastCell;
    
    if (_isLastCell) {
        if (_isFirstCell) {
        }else {
            _stepButtomView.hidden = _isLastCell;
        }
        _buttomLine.hidden = YES;
    }
}

- (void)setIsMiddleCell:(BOOL)isMiddleCell {
    _isMiddleCell = isMiddleCell;
    if (_isMiddleCell) {
        _stepTopView.hidden = NO;
        _step.image = [UIImage imageNamed:@"dot_grey"];
        _stepButtomView.hidden = NO;
    }
}


- (void)setModel:(ZSBStatusDetailInfo *)model {
    _model = model;
    _ordorStatusLabel.text = _model.stepStatus;
    _timeLabel.text = _model.updateDate;
    NSAttributedString *attrStr = [[NSAttributedString alloc] initWithData:[_model.stepDetail dataUsingEncoding:NSUnicodeStringEncoding] options:@{NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType, NSForegroundColorAttributeName:[UIColor colorWithHexString:@"999999"]} documentAttributes:nil error:nil];
    _stepDetailLabel.attributedText = attrStr;
//    _stepDetailLabel.text = [_model.stepDetail stringByReplacingOccurrencesOfString:@"\\n"withString:@"\n"];
}


- (void)setBusinessModel:(NewMissionBusinessNumberProcessModel *)businessModel {
    _businessModel = businessModel;
    _ordorStatusLabel.text = [NSString stringWithFormat:@"姓名：%@", _businessModel.USER_NAME];
    _timeLabel.text = [NSString stringWithFormat:@"接单人：%@",_businessModel.USER_MOBILE];
    _stepDetailLabel.text = [NSString stringWithFormat:@"项目：%@", _businessModel.PROJECT_NAME];
    
}
@end

